<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/layui/css/layui.css">
<title>Insert title here</title>
</head>
<body>
<div style="margin-top: 40px;text-align: center;">
	<form class="layui-form" id = "form" action="">
			  <div class="layui-form-item">
			    <label class="layui-form-label">投诉类别</label>
			    <div class="layui-input-block">
			      <input type="text" name="complaintType" id ="complaintType" lay-verify="title" autocomplete="off" placeholder="请输入投诉类别" class="layui-input">
			    </div>
			  </div>
			  <div class="layui-form-item">
			    <label class="layui-form-label">投诉描述</label>
			    <div class="layui-input-block">
			      <input type="text" name="complaintDesc" id ="complaintDesc" lay-verify="title" autocomplete="off" placeholder="投诉描述" class="layui-input">
			    </div>
			  </div>
			  <input name="userName" type="hidden" value="${userLogin}">
			 
	  </form>
</div>
	
</body>
<script src="https://cdn.bootcss.com/jquery/2.2.1/jquery.min.js"></script>
<script src="/layui/layui.js"></script>
<script type="text/javascript">
var laydate //日期
,laypage //分页
,layer //弹层
,table //表格
,carousel //轮播
,element; //元素操作
$(function(){
	layui.use(['laydate', 'laypage', 'layer', 'table', 'carousel', 'upload', 'element'], function(){
		  laydate = layui.laydate ;//日期
		  laypage = layui.laypage ;//分页
		  layer = layui.layer ;//弹层
		  table = layui.table ;//表格
		  carousel = layui.carousel; //轮播
		  element = layui.element; //元素操作
	});
})
function add(){
	var bool = false;
	var complaintType = $("#complaintType").val();
	if(complaintType ==''){
		layer.msg('投诉类别不能为空');
		return false;
	}
	var complaintDesc = $("#complaintDesc").val();
	if(complaintDesc ==''){
		layer.msg('投诉描述不能为空');
		return false;
	}
	$.ajax({
	    //几个参数需要注意一下
	        type: "POST",//方法类型
	       	async:false, 
	        dataType: "json",//预期服务器返回的数据类型
	        url: "/userComplaint/insertUserGuarantee" ,//url
	        data: $('#form').serialize(),
	        success: function (data) {
	            if (data.statue) {
	            	bool = true;
	            	layer.msg('投诉成功', {icon: 1});
	            }
	            ;
	        },
	        error : function() {
	            
	        }
	    });
	return bool;
}
</script>
</html>